'use strict';
// Copyright 2014 Blueant Inc. All Rights Reserved.

/**
 * @fileoverview 英雄星座
 * @author sundbcn@gmail.com (sun debing)
 */
var _ = require('lodash');
var dataApi = require('../libs/dataApi');

/**
 * 取英雄星座等级配置
 * @param  {[type]} vip [description]
 * @return {[type]}     [description]
 */
exports.getConf = function (lv) {
    return dataApi.hero_constellation.findById(lv) || null;
};

/**
 * 取条件副本星数
 * @param  {[type]} vip [description]
 * @return {[type]}     [description]
 */
exports.getNeedStar = function (lv) {
    var conf = dataApi.hero_constellation.findById(lv);
    if (!conf) {
        return null;
    }
    var all_need_star = conf.all_need_star;
    return all_need_star;
};

/**
 * 取条件副本星数
 * @param  {[type]} vip [description]
 * @return {[type]}     [description]
 */
exports.getMaxLv = function () {
    var conf = dataApi.hero_constellation.all();
    var max_lv = 0;
    _.each(conf, function (item) {
        if (item.id > max_lv) {
            max_lv = item.id;
        }
    });
    return max_lv;
};
